import axios from "axios"
import nprogress from "nprogress"
import "nprogress/nprogress.css"

export const requestMock = axios.create({
    baseURL:process.env.VUE_APP_MOCK,
    timeout:10000,
})

requestMock.interceptors.request.use((config)=>{
    // console.log(config);
    nprogress.start()
    return config
},(error)=>{
    nprogress.done()
    return Promise.reject(error.message)
})

requestMock.interceptors.response.use((response)=>{
    // console.log(response);
    nprogress.done()
    return response.data.data
},(error)=>{
    nprogress.done()
    return Promise.reject(error.message)
})


